home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
distutils
/
versionpredicate.pyo
(
.txt
)
< prev
Wrap
Python Compiled Bytecode
|
2008-10-13
|
3KB
|
75 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import re
import distutils.version as distutils
import operator
re_validPackage = re.compile('(?i)^\\s*([a-z_]\\w*(?:\\.[a-z_]\\w*)*)(.*)')
re_paren = re.compile('^\\s*\\((.*)\\)\\s*$')
re_splitComparison = re.compile('^\\s*(<=|>=|<|>|!=|==)\\s*([^\\s,]+)\\s*$')
def splitUp(pred):
res = re_splitComparison.match(pred)
if not res:
raise ValueError('bad package restriction syntax: %r' % pred)
(comp, verStr) = res.groups()
return (comp, distutils.version.StrictVersion(verStr))
compmap = {
'<': operator.lt,
'<=': operator.le,
'==': operator.eq,
'>': operator.gt,
'>=': operator.ge,
'!=': operator.ne }
class VersionPredicate:
def __init__(self, versionPredicateStr):
versionPredicateStr = versionPredicateStr.strip()
if not versionPredicateStr:
raise ValueError('empty package restriction')
match = re_validPackage.match(versionPredicateStr)
if not match:
raise ValueError('bad package name in %r' % versionPredicateStr)
(self.name, paren) = match.groups()
paren = paren.strip()
def __str__(self):
pass
def satisfied_by(self, version):
for cond, ver in self.pred:
if not compmap[cond](version, ver):
return False
continue
return True
_provision_rx = None
def split_provision(value):
global _provision_rx
if _provision_rx is None:
_provision_rx = re.compile('([a-zA-Z_]\\w*(?:\\.[a-zA-Z_]\\w*)*)(?:\\s*\\(\\s*([^)\\s]+)\\s*\\))?$')
value = value.strip()
m = _provision_rx.match(value)
if not m:
raise ValueError('illegal provides specification: %r' % value)
if not m.group(2):
pass
ver = None
if ver:
ver = distutils.version.StrictVersion(ver)
return (m.group(1), ver)